﻿<controls:ChildWindow xmlns:inputToolkit1="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input.Toolkit"  xmlns:inputToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input"  
                      xmlns:Toolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"
                      x:Class="ibba.src.norisk.PageDetalheContrato"
                      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
                      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
                      xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
                      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
                      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" 
                      xmlns:basics="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls" 
                      xmlns:src="clr-namespace:ibba.src.norisk"
	                  HorizontalAlignment="Center" 
	                  VerticalAlignment="Center" xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows" 
		              xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data" 
		              Height="560" Width="670" 
		              Title="Detalhes da parametrização do Contrato"
		            Background="#FF5C7590">

    <controls:ChildWindow.Resources>
        <src:ConverterNumericUpDown x:Key="ConverterNUD" />
        <src:ConverterTypeCheckBox x:Key="ConverterCHK" />
        <src:ConverterValueCheckBox x:Key="ConverterValueCHK" />
        <src:ConverterDefaultCheckBox x:Key="ConverterDefaultCHK" />
        <src:ConverterValueTextBox x:Key="ConverterValueTxtBox" />
        <src:ConverterTextBox x:Key="ConverterTxtBox" />
        <src:ConverterComboBox x:Key="ConverterCboBox" />
        <src:ConverterReadonly x:Key="ConverterReadonly"/>
    </controls:ChildWindow.Resources>

    <Grid HorizontalAlignment="Stretch" 
          Background="{x:Null}"
		  VerticalAlignment="Stretch" >

        <Toolkit:BusyIndicator x:Name="activity">

            <Grid x:Name="LayoutRoot" HorizontalAlignment="Left" VerticalAlignment="Top" Height="517" Width="644">
                <!--<Rectangle Height="43" HorizontalAlignment="Left" Margin="6,262,0,0" Name="rectangle1" Stroke="#FF4545BA" StrokeThickness="12" VerticalAlignment="Top" Width="551" RadiusY="12" RadiusX="12" Style="{StaticResource DividerStyle}" Fill="#FF4545BA" IsHitTestVisible="True" />-->

                <TextBlock 
					x:Name="txtLabContrato" 
                   	Text="Contrato:" 
                   	FontSize="10"
                   	Foreground="#FFF2ECDA"
                   	Margin="22,20,0,0" 
					VerticalAlignment="Top" Width="auto" 
					HorizontalAlignment="Left" FontFamily="Verdana" d:LayoutOverrides="VerticalAlignment" 
				/>

                <TextBlock 
					x:Name="txtContrato" 
                   	Text="Contrato" 
                   	FontSize="10"
                   	Foreground="#FFFADE88"
                   	Margin="88,20,0,0" 
					VerticalAlignment="Top" Width="auto" 
					HorizontalAlignment="Left" FontFamily="Verdana" d:LayoutOverrides="VerticalAlignment"  FontWeight="Bold" 
				/>

                <TextBlock x:Name="txtLabCliente"
                            FontSize="10"
    		                Foreground="#FFF2ECDA"
    		                Margin="23,40,0,0"
    		                VerticalAlignment="Top" Width="auto" FontFamily="Verdana" HorizontalAlignment="Left" 
			                Text="Cliente:"	/>

                <TextBlock 
					x:Name="txtCliente" 
                   	Text="Cliente" 
                	FontSize="10"
                   	Foreground="#FFFADE88"
                   	Margin="88,40,0,0" 
					VerticalAlignment="Top" Width="auto" 
					HorizontalAlignment="Left" FontFamily="Verdana" d:LayoutOverrides="VerticalAlignment"  FontWeight="Bold"              
                
				/>

                <TextBlock x:Name="txtLAbGrupoEconomico"
                            FontSize="10"
    		                Foreground="#FFF2ECDA"
    		                Margin="23,59,0,0"
    		                VerticalAlignment="Top" Width="auto" FontFamily="Verdana" 
			                Text="Grupo Econômico:" HorizontalAlignment="Left"	/>

                <TextBlock 
					x:Name="txtGrupoEconomico" 
                   	Text="Grupo Econômico" 
                	FontSize="10"
                   	Foreground="#FFFADE88"
                   	Margin="123,59,0,0" 
					VerticalAlignment="Top" Width="auto" FontFamily="Verdana" d:LayoutOverrides="VerticalAlignment"  FontWeight="Bold" HorizontalAlignment="Left"               
				/>

                <data:DataGrid AutoGenerateColumns="False" Height="375" Margin="22,90,22,0" Background="#FF9AACB7" Name="grdParametroContrato"  VerticalAlignment="Top" BorderBrush="{x:Null}" ItemsSource="{Binding}">
                    <data:DataGrid.Columns>
                        <data:DataGridTextColumn Header="Id" Width="1" Binding="{Binding Path=CdParametro}" Visibility="Collapsed"/>

                        <data:DataGridTemplateColumn Header="" Width="20">
                            <data:DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <Button Width="68" 
                                        Height="24"
    									HorizontalAlignment="Center" 
    									x:Name="btnDetalhes"
    									Click="btnDetalhes_Click">

                                        <StackPanel Name="detalhesParam"  VerticalAlignment="Center" Margin="0" HorizontalAlignment="Center" Orientation="Horizontal" Height="24">
                                            <Image Source="../image/search.png" Width="20" HorizontalAlignment="Center" Margin="0,0,0,0" ToolTipService.ToolTip="Detalhes do Parâmetro" />
                                        </StackPanel>

                                    </Button>
                                </DataTemplate>
                            </data:DataGridTemplateColumn.CellTemplate>
                        </data:DataGridTemplateColumn>

                        <data:DataGridTextColumn Header="Parâmetro" Width="304" Binding="{Binding Path=DscParametro}" IsReadOnly="True" />

                        <data:DataGridTemplateColumn Header="Valor" Width="100">
                            <data:DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <StackPanel Name="panelValor"  VerticalAlignment="Top" Margin="0" HorizontalAlignment="Right" Orientation="Horizontal">

                                        <inputToolkit1:NumericUpDown Name="nup" Width="150" IsEnabled="False"
                                            Value="{Binding Path=VlrParametro, Mode=TwoWay}" HorizontalAlignment="Center"   
                                                                 VerticalAlignment="Center" Margin="0" DecimalPlaces="2"
                                                                 Increment="1.00" Maximum="9999999999999999" Minimum="0"
                                            Visibility="{Binding Path=DscTipoCampo, Converter={StaticResource ConverterNUD}}" Parsing="numUpDown_Parsing"
                                                          />

                                        <CheckBox Width="30" HorizontalAlignment="Center"   VerticalAlignment="Center" IsEnabled="False"
                                              IsChecked="{Binding Path=VlrParametro, Converter={StaticResource ConverterValueCHK}, Mode=TwoWay}"
                                              Visibility="{Binding Path=DscTipoCampo, Converter={StaticResource ConverterCHK}}"/>

                                        <TextBox Name="txtBox" Width="100" 	MaxLength="30" IsReadOnly="True" 
											Text="{Binding Path=VlrParametro, Mode=TwoWay, Converter={StaticResource ConverterValueTxtBox}}" HorizontalAlignment="Center"   
                                                 VerticalAlignment="Center" Margin="0"
											     Visibility="{Binding Path=DscTipoCampo, Converter={StaticResource ConverterTxtBox}}" />

                                    </StackPanel>
                                </DataTemplate>
                            </data:DataGridTemplateColumn.CellTemplate>
                        </data:DataGridTemplateColumn>

                        <data:DataGridTemplateColumn Header="Motivo" Width="100">
                            <data:DataGridTemplateColumn.CellEditingTemplate>
                                <DataTemplate>
                                    <StackPanel Name="panelValor"  VerticalAlignment="Center" Margin="0" HorizontalAlignment="Right" Orientation="Horizontal">
                                        <ComboBox Name="domainMotivos"
                                              Width="100" Height="24"
                                              Loaded="cboMotivo_Loaded"
                                              IsEnabled="False">

                                            <ComboBox.ItemTemplate>
                                                <DataTemplate>
                                                    <StackPanel>
                                                        <TextBlock Text="{Binding DscMotivo}" />
                                                    </StackPanel>
                                                </DataTemplate>
                                            </ComboBox.ItemTemplate>

                                        </ComboBox>
                                    </StackPanel>
                                </DataTemplate>
                            </data:DataGridTemplateColumn.CellEditingTemplate>
                        </data:DataGridTemplateColumn>
                        
                        <data:DataGridTemplateColumn Header="Default?" Width="74">
                            <data:DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <CheckBox HorizontalAlignment="Center" Name="chkDefault" IsEnabled="False"
									IsChecked="{Binding Path=IcDefault,  Converter={StaticResource ConverterReadonly}, Mode=TwoWay}" />
                                </DataTemplate>
                            </data:DataGridTemplateColumn.CellTemplate>
                        </data:DataGridTemplateColumn>

                    </data:DataGrid.Columns>
                </data:DataGrid>


                <Grid Height="40" Margin="110,0,85,8" VerticalAlignment="Bottom" >

                    <Border Background="#FF9AACB7" CornerRadius="10" Margin="-8,0,8,0" />
                    <Button 
    			x:Name="btnFechar"    
    			Click="btnFechar_Click" TabIndex="18" Margin="166,7,163,8" RenderTransformOrigin="0.455,-0.92">
                        <StackPanel Orientation="Horizontal">
                            <Image Source="../image/voltar.png" Height="34" Width="34" Margin="0,-18,0,0" 
    					Stretch="Uniform" VerticalAlignment="Top" HorizontalAlignment="Left" />
                            <TextBlock Text="Voltar" Margin="-8,0,0,0"/>
                        </StackPanel>
                    </Button>

                </Grid>


            </Grid>
        </Toolkit:BusyIndicator>
    </Grid>

</controls:ChildWindow>
    
    